package com.itheima.service.impl;

import com.itheima.domain.User;
import com.itheima.mapper.UserMapper;
import com.itheima.mapper.impl.UserMapperImpl;
import com.itheima.service.UserService;

import java.util.List;

public class UserServiceImpl implements UserService {
    //创建持久层对象
    private UserMapper mapper = new UserMapperImpl();

    //查询所有
    public List<User> selectAll() throws Exception {
        return mapper.selectAll();
    }

    //根据id查询
    public User selectById(Integer uid) throws Exception {
        return mapper.selectById(uid);
    }

    //添加信息
    public Integer insertUser(User user) throws Exception {
        return mapper.insertUser(user);
    }

    //修改信息
    public Integer updateUser(User user) throws Exception {
        return mapper.updateUser(user);
    }

    //删除信息
    public Integer deleteUser(Integer uid) throws Exception {
        return mapper.deleteUser(uid);
    }
}
